package appDatabase

import androidx.compose.ui.platform.Context
import androidx.room.Room
import androidx.sqlite.driver.bundled.BundledSQLiteDriver
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.IO

actual class DBFactory() {
    actual fun createDatabase(): AppDatabase {
//        val dbFile = context.getDatabasePath(dbFileName)
//        val filePath = "/data/storage/el2/base/haps/entry/files/$dbFileName"
        val filePath = "/data/storage/el2/base/files/$dbFileName"
//        val filePath = "/tmp/$dbFileName"
        println(filePath)
        val db = Room.databaseBuilder<AppDatabase>(filePath)
            .setDriver(BundledSQLiteDriver())
            .setQueryCoroutineContext(Dispatchers.IO)
            .build()
        println("创建数据库 ${db.getDao()}")
        return db
    }
}

